"change atan2_safe to atan2" followup#7531
Conversation
Follow-up to scp-fs2open#6255. Partially restore use of `atan2_safe` from 87ea04f: keep special case while delegating most cases to atan2. Fixes scp-fs2open#7530.
Baezon
left a comment
There was a problem hiding this comment.
Sigh... any negative 0 in either argument of atan2 results in ±pi, which means floating point inaccuracy and instability, especially around poles. This isn't really "safety", if you want to be pedantic about the naming, more than it is guaranteeing the result is +0 which will stay stable.
|
layman question: Why use atan2 at all rather then the original volition function? What's the performance vs inaccuracy trade-off being made here? |
The primary reason is for the special case at 0, 0. See the comment on the previous PR:
In most respects the library function is to be preferred over the hand-rolled function, so changing to |
Follow-up to #6255. Partially restore use of
atan2_safefrom 87ea04f: keep special case while delegating most cases to atan2.Fixes #7530.